import {store} from '../store/index';
import {router} from '@/routers/router';
import {watch} from 'vue';

export function CIOps(){  
    let token = sessionStorage.getItem('CREATE_ROUTER');
    let cacheRouter = sessionStorage.getItem('ROUTER_PATH'); 
    // default
    if(cacheRouter){
        sessionStorage.setItem('ROUTER_PATH',cacheRouter);    
    }else{
        sessionStorage.setItem('ROUTER_PATH','/');
    } 
    // push
    if(token){
        store.dispatch('CREATE_ROUTER',token) 
    }else{
        router.push('/login') 
    }
    
} 